$OpenBSD: patch-src_unix_c,v 1.1 2010/09/13 07:36:01 sthen Exp $

patches from upstream git repo;

- don't freeze when invoking with sh -c
- don't wait until a key is pressed before checking buffers

--- src/unix.c.orig	Mon Dec 14 03:12:55 2009
+++ src/unix.c	Sun Sep 12 12:08:01 2010
@@ -211,8 +211,19 @@ static void set_process_group (void)
      {
 	pid_t pid = getpid ();
 	Startup_PGID = getpgid (pid);
-	(void) tcsetpgrp (Read_FD, pid);
-	(void) setpgid (pid, pid);
+	if (-1 == tcsetpgrp (Read_FD, pid))
+	  {
+	     fprintf (stderr, "tcsetpgrp failed\n");
+	     Terminal_PGID = -1;
+	     return;
+	  }
+	if (-1 == setpgid (pid, pid))
+	  {
+	     fprintf (stderr, "setpgid failed\n");
+	     (void) tcsetpgrp (Read_FD, Startup_PGID);
+	     Terminal_PGID = -1;
+	     return;
+	  }         
      }
 #endif
 }
@@ -422,6 +433,7 @@ unsigned char sys_getkey (void) /*{{{*/
 	/* update status line in case user is displaying time */
 	if (Display_Time || all)
 	  {
+	     check_buffers ();              
 	     JWindow->trashed = 1;
 	     update((Line *) NULL, 0, 1, 0);
 	  }
